/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package manager;

import entity.Transactions;
import java.sql.Timestamp;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import session.stateless.TransactionsSessionLocal;

/**
 *
 * @author Jacko
 */
public class TransactionsManager {

    private TransactionsSessionLocal transactionsSessionLocal;

    public TransactionsManager() {
    }

    public TransactionsManager(TransactionsSessionLocal transactionsSessionLocal) {
        this.transactionsSessionLocal = transactionsSessionLocal;
    }

    public List<Transactions> getAllTransactions() {
        return transactionsSessionLocal.getAllTransactions();
    }

    public List<Transactions> getMyTransactions() {

        return transactionsSessionLocal.getMyTransactions();
    }

    public Long addTransaction(HttpServletRequest request) {
        Timestamp transDate = Timestamp.valueOf("transDate");
        String transDesc = request.getParameter("transDesc");
        Double transAmt = Double.valueOf(request.getParameter("transAmt"));
        String status = request.getParameter("status");
        Long stakeholderID = Long.valueOf(request.getParameter("stakeholderID"));

        return transactionsSessionLocal.addTransaction(transDate, transDesc, status, stakeholderID);
    }
}
